package com.yl.projects.viewmodel

import com.yl.common.base.BaseViewModel
import com.yl.common.network.RespStateData
import com.yl.projects.bean.Project
import com.yl.projects.bean.ProjectType
import com.yl.projects.repo.ProjectRepo

/**
 * Created by stew on 8/5/22.
 */
class ProjectViewModel(private var repo: ProjectRepo) : BaseViewModel() {

    var projectList = RespStateData<List<ProjectType>>()
    fun getProTypeList() = launch { repo.getProTypeList(projectList) }

    var proList = RespStateData<Project>()


    fun getProjectChildList(currentPage: Int, cid: Int) =
        launch { repo.getProjectChildList(currentPage, cid, proList) }


    var collectData = RespStateData<String>()

    fun collect(id: Int) {
        launch { repo.collect(id, collectData) }

    }

    fun unCollect(id: Int) {
        launch { repo.unCollect(id, collectData) }

    }
}